<template>
  <el-dialog v-model="visible" title="物流详情" :close-on-click-modal="false">
    <el-descriptions title="物流信息" style="margin-bottom: 20px;">
        <el-descriptions-item label="物流公司:">{{dataForm.data.companyName}}</el-descriptions-item>
        <el-descriptions-item label="物流单号:">{{dataForm.data.dvyFlowId}}</el-descriptions-item>
    </el-descriptions>
    <el-timeline>
      <el-timeline-item
        v-for="(activity, index) in dataForm.data.data"
        :key="index"
        :timestamp="activity.time"
      >
        {{ activity.context }}
      </el-timeline-item>
    </el-timeline>
  </el-dialog>
</template>

<script setup>
//const resourcesUrl = import.meta.env.VITE_APP_RESOURCES_URL;
//const emit = defineEmits(["refreshDataList"]);

const dataForm = ref({
  orderNumber: "",
  data: {},
});
const visible = ref(false);
const dataFormRef = ref(null);
const init = (orderNumber) => {
  visible.value = true;
  dataForm.value.orderNumber = orderNumber || null;

  /*nextTick(() => {
    dataFormRef.value?.resetFields();
  });*/

  if (dataForm.value.orderNumber) {
    http({
      url: http.adornUrl(
        `/admin/delivery/check?orderNumber=${dataForm.value.orderNumber}`
      ),
      method: "get",
      params: http.adornParams(),
    }).then(({ data }) => {
      dataForm.value.data = data;
    });
  }
};
defineExpose({ init });
</script>
